function plot_histogram(logPlotFlag,logAxisFlag,modePlotFlag,indexToPlot,numbins,hist_res,data,params,mode)
hist_fig=figure;
%output_dir='C:\Users\Michael Ferry\projects\project_thesis\Dissertation\Figures\Reduced_size\Figure files\yGAL\raw_files\';
%params.print='true';
params.print='false';
labelFS=8;
axisFS=6;
printedXsize=3;
printedYsize=3;

% logPlotFlag=parameters.logPlotFlag;
% logAxisFlag=parameters.logAxisFlag;
% modePlotFlag=parameters.modePlotFlag;
% 
% hist_res=parameters.xbins;
% xrange=parameters.xBinRange;
% ybins=parameters.ybins;
%yrange=parameters.yBinRange;
%xplotRange=parameters.xplotRange;
%yplotRange=parameters.yplotRange;

% labelFS=parameters.labelFS;
% axisFS=parameters.axisFS;
% printedXsize=parameters.printedXsize;
% printedYsize=parameters.printedYsize;

set(hist_fig, 'PaperUnits', 'centimeters');
set(hist_fig, 'PaperSize', [printedXsize printedYsize]);
set(hist_fig, 'PaperPositionMode', 'manual');
set(hist_fig, 'PaperPosition', [0 0 printedXsize printedYsize]);

%Determines if logrithmically distributed bins are required
if(logPlotFlag)
    %scaled_bins=exp((1:hist_res)*(log(numbins)/hist_res));
    scaled_bins=10.^((1:hist_res)*(log10(numbins)/hist_res));
    hist(data,scaled_bins); 
    [n x]=hist(data,scaled_bins);
    h = findobj(gca,'Type','line');
    set(h,'Marker','none');
    %set(gca,'Xlim',[10 2^18])
else
    hist(data,hist_res);
    [n x]=hist(data,hist_res);
end
%Determines if a log axis is required
if(logAxisFlag)
    set(get(hist_fig,'CurrentAxes'),'XScale','Log');
end

% xlabel([params.par(indexToPlot).name,' v:',num2str(params.par(indexToPlot).voltage)]...
%    ,'FontName','Times-Roman','FontSize',labelFS);
xlabel('Forward Scatter (A.U.)','FontName','Times-Roman','FontSize',labelFS);
ylabel('Counts','FontName','Times-Roman','FontSize',labelFS)
title('Gal1 uninduced (500 \muM)','FontName','Times-Roman','FontSize',labelFS)

%Determins if mode lines and mode values are printed on the plot
%if(get(handles.checkbox1,'Value')==1)
if(modePlotFlag)
    
    for i=1:length(mode)
        line([mode(i).value mode(i).value],[0 max(n)*1.025],'Color','r');
        text(mode(i).value,max(n)*1.075,num2str(fix(mode(i).value)),'FontName','Times-Roman','FontSize',axisFS);
        try
        line([mode(i).lower mode(i).lower],[0 max(n)*1.025],'Color','g');
        line([mode(i).upper mode(i).upper],[0 max(n)*1.025],'Color','g');
        catch
            %'no mode boundaries'
        end
    end
end
set(gca,'Ylim',[0 1.2*max(n)])

set(gca,'FontName','Times-Roman','FontSize',axisFS)
set(gca,'Color','none');
set(hist_fig, 'Color', 'none');

if(strcmp(params.print,'true'))
    print(hist_fig, '-depsc2','-painters', [output_dir datestr(now,30)]);
end